#include<linux/module.h>
#include<linux/sched.h>
#include<linux/pid.h>
#include<linux/wait.h>
#include<linux/kthread.h>
MODULE_LICENSE("GPL");

int my_function(void *argc)
{
	printk("in the kernel thread function!\n");
	printk("the current pid is:%d\n",current->pid);
	printk("out the kernel thread function!\n");
	return 0;
}
static int __init kthread_create_on_node_init(void)
{
	struct task_struct *result;
	printk("into kthread_create_on_node_init.\n");

	result=kthread_create_on_node(my_function,NULL,-1,"kthread_create_on_node_init.c");
	printk("the pid os the new thread is :%d\n",result->pid);
	wake_up_process(result);
	printk("the current pid is:%d\n",current->pid);
	printk("out kthread_create_on_node_init.\n");
	return 0;
}
static void __exit kthread_create_on_node_exit(void)
{
	printk("Goodbye kthread_create_on_node\n");
}
module_init(kthread_create_on_node_init);
module_exit(kthread_create_on_node_exit);

